package com.dd.machine.main.commons;

import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;

import com.dd.machine.base.net.URLManager;
import com.dd.machine.main.user.GoodsKindActivity;
import com.dd.machine.main.user.LoginActivity;
import com.zhy.http.okhttp.OkHttpUtils;
import com.zhy.http.okhttp.callback.StringCallback;

import org.json.JSONException;
import org.json.JSONObject;

import okhttp3.Call;

import static com.dd.machine.base.net.URLManager.CARDLOGIN;
import static com.dd.machine.base.net.URLManager.CARDPHONEBIND;
import static com.dd.machine.base.net.URLManager.MOBILEBIND;

/**
 * Created by Administrator on 2017/7/13.
 */

public class PostServer {
    //推送puisid
    public static void pushId(String deviceToken, String pushId, String os) {
        Log.e("==token", deviceToken);
        Log.e("==pushId", pushId);
        Log.e("==model", Build.MODEL);
        Log.e("==os", os + "");

        OkHttpUtils.post()
                .url(URLManager.PUSHID)
                .addParams("equipmentNo","JINANDINGGAO")
                .addParams("deviceToken", deviceToken)
                .addParams("pushId", pushId)
                .addParams("os", os)
                .addParams("model", Build.MODEL)
                .addParams("appVersion", "machine1.0")
                .build()
                .execute(new StringCallback() {
                    @Override
                    public void onError(Call call, Exception e, int id) {
//                        Log.e("===onError", e.getMessage());
                    }

                    @Override
                    public void onResponse(String response, int id) {
                        Log.e("===PushidonResponse", response);
                    }
                });
    }

    //获取验证码
    public static void getVerifyCode(String phone) {
        OkHttpUtils.post()
                .url(URLManager.SENDVERIFYCODE)
                .addParams("mobilePhone", phone)
                .build()
                .execute(new StringCallback() {
                    @Override
                    public void onError(Call call, Exception e, int id) {
//                        Log.e("===code OnError", e.getMessage());
                    }

                    @Override
                    public void onResponse(String response, int id) {
                        Log.e("===code onResponse", response);
                    }
                });

    }
}
